import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Test {

    public static void main(String[] args) {
        MyBinarytree myBinarytree = new MyBinarytree();
        MyBinarytree.TreeNode treeNode = myBinarytree.createTree();
        System.out.print("前序遍历:");
        myBinarytree.preOrder(treeNode);
        System.out.println();
        System.out.print("中序遍历:");
        myBinarytree.inOrder(treeNode);
        System.out.println();
        System.out.print("后序遍历:");
        myBinarytree.postOrder(treeNode);
        System.out.println();
        System.out.println("-----------------------");

        int ret = myBinarytree.getHeight(treeNode);
        System.out.println("二叉树的最大高度:"+ret);
        System.out.println("-----------------------");

        myBinarytree.size(treeNode);
        System.out.println("二叉树的节点个数为:"+ MyBinarytree.nodeSize);//类名.
        System.out.println("二叉树的节点个数为:"+ myBinarytree.size2(treeNode));
        System.out.println("-----------------------");

        myBinarytree.getLeafNodeCount1(treeNode);
        System.out.println("二叉树的叶子结点个数为:"+MyBinarytree.leafSize);
        System.out.println("二叉树的叶子结点个数为:"+myBinarytree.getLeafNodeCount2(treeNode));
        System.out.println("-----------------------");

        System.out.println("二叉树第1层结点个数为:"+myBinarytree.getKLevelNodeCount(treeNode,1));
        System.out.println("二叉树第2层结点个数为:"+myBinarytree.getKLevelNodeCount(treeNode,2));
        System.out.println("二叉树第3层结点个数为:"+myBinarytree.getKLevelNodeCount(treeNode,3));
        System.out.println("二叉树第4层结点个数为:"+myBinarytree.getKLevelNodeCount(treeNode,4));
        //System.out.println("二叉树第5层结点个数为:"+myBinarytree.getKLevelNodeCount(treeNode,5));
        System.out.println("-----------------------");

        System.out.println("是否存在结点:"+myBinarytree.find(treeNode,'E').val);
        System.out.println("-----------------------");

        MyBinarytree.TreeNode treeNode2 = myBinarytree.createTree();
        MyBinarytree.TreeNode treeNode3 = myBinarytree.createTree2();
        System.out.println("两棵树是都相同:"+myBinarytree.isSameTree(treeNode,treeNode2));
        System.out.println("两棵树是都相同:"+myBinarytree.isSameTree(treeNode,treeNode3));
        System.out.println("-----------------------");

        System.out.println("层序遍历:");
        myBinarytree.levelOrder(treeNode);
        List<List<Character>> lists = myBinarytree.levelOrder2(treeNode);
        System.out.println();
        System.out.println(lists.toString());
        System.out.println("-----------------------");

        System.out.println("treeNode 是否是一颗完全二叉树:"+ myBinarytree.isCompleteTree(treeNode));
        System.out.println("treeNode3 是否是一颗完全二叉树:"+ myBinarytree.isCompleteTree(treeNode3));
        System.out.println("-----------------------");

        /*Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        MyBinarytree.TreeNode treeNode4 = myBinarytree.createTree3(str);
        System.out.print("中序遍历为:");
        myBinarytree.inOrder(treeNode4);
        System.out.println("-----------------------");*/

        List<Character> list = myBinarytree.preorderTraversal(treeNode);
        System.out.println("非递归版前序遍历: "+ list.toString());
        /*for (int i = 0; i < list.size(); i++) {
            System.out.print(list.get(i)+" ");
        }*/


    }
}
